{% extends "layout.html" %}

{% block content %}
<div class="ty-searchblock ty-homeblock1 py-5">
    <div class="container py-lg-4 py-md-3">
        <!-- block -->
        <div class="row">
            <div class="col-lg-8 most-recent">
                <div class="row">
                    {% for data in products %}
                    <div class="col-lg-6 col-md-6 item mt-5 pt-lg-3">
                        <div class="card">
                            <div class="card-header p-0 position-relative">
                                <a href="/product/{{ data.id }}">
                                    <img class="card-img-bottom d-block radius-image" src="{{ data.image }}" alt="{{ data.name }}">
                                </a>
                            </div>
                            <div class="card-body p-0 blog-details">
                                <a href="/product/{{ data.id }}" class="blog-desc">{{ data.name }}</a>
                                <div class="author align-items-center mt-3 mb-1">
                                    <a href="/taxon?cid={{ data.tid }}">{{ data.taxon_name }}</a>  <a href="/product/{{ data.id }}">查看</a>
                                </div>
                                <ul class="blog-meta">
                                    <li class="meta-item blog-lesson">
                                        <span class="meta-value"> {{ data.created_at.format("%Y-%m-%d") }} </span>
                                    </li>
                                    <li class="meta-item blog-students">
                                        <span class="meta-value"> {{ data.hits }}浏览</span>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                    {% endfor %}
                </div>

                <!-- pagination -->
                <div class="pagination-wrapper mt-5">
                    <ul class="page-pagination">
                        {{ paginate|safe  }}

                    </ul>
                </div>
                <!-- //pagination -->
            </div>
            <div class="col-lg-4 trending mt-lg-0 mt-5 mb-lg-5">
                <div class="pos-sticky">
                    <h3 class="section-title-left">产品分类 </h3>
                    {% for data in taxons %}
                    <div class="grids5-info">
                        <h4>0{{ loop.index }}.</h4>
                        <div class="blog-info">
                            <a href="/taxon?cid={{ data.id }}" class="blog-desc1">
                                <div class="category-item">
                                    <div class="category-img">
                                        <img src="{{ data.image }}" alt="{{ data.name }}" class="img-fluid"/>
                                    </div>
                                    <div class="category-name">
                                        <p>{{ data.name }} </p>
                                        <p class="category-resources">{{ data.num }}文章</p>
                                    </div>
                                </div>
                            </a>
                        </div>
                    </div>
                    {% endfor %}
                </div>
            </div>
        </div>
        <!-- //block-->

        <!-- ad block -->
        <div class="ad-block text-center mt-5">
            <a href="#url"><img src="assets/images/ad.gif" class="img-fluid" alt="ad image" /></a>
        </div>
        <!-- //ad block -->
    </div>
</div>

{% endblock %}